]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Don't move window when it got unmanaged during shift animation
authorSebastian Keller <skeller@gnome.org>
Sat, 25 Oct 2025 11:03:55 +0000 (13:03 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:42:59 +0000 (14:42 +0100)
When a window with a text-entry at the bottom that had triggered the OSK
and was shifted up to avoid overlapping the OSK is closed right after
losing keyboard focus, this results in a crash. The focus loss triggers
the animation to move the window actor back into its original position,
which moves the underlying window when finished. That however will fail
when the window has been unmanaged and some of the underlying resources
have already been destroyed while the animation was playing.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8752
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3933>
(cherry picked from commit 4900aad2deab7398e69b1a57a38285fa73974c0f)

js/ui/keyboard.js

index 47f0b00b392028d0a1f5a80c539df03c0ab392bd..6d4fecbf8f98b1089a1c16f85163461ab08b0735 100644 (file)
@@ -1920,11 +1920,21 @@ export const Keyboard = GObject.registerClass({
             ? this._focusWindowStartY - Main.layoutManager.keyboardBox.height
             : this._focusWindowStartY;
 
+        let unmanaged = false;
+        const winUnmanagedId = window.connect('unmanaged', () => {
+            unmanaged = true;
+        });
+
         windowActor.ease({
             y: finalY,
             duration: KEYBOARD_ANIMATION_TIME,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
             onStopped: () => {
+                window.disconnect(winUnmanagedId);
+
+                if (unmanaged)
+                    return;
+
                 windowActor.y = finalY;
                 this._windowSlideAnimationComplete(window, finalY);
             },